<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="author" content="挥手の骑士">
    
    
    
    
    
    
    <title>SpringDataJPA 分页 排序与动态查询 | 骑士の物语</title>
    <link href="https://yihuishou.gitee.io" rel="prefetch">

    <link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/aos.css">
<link rel="stylesheet" href="/css/style.css">
    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/aos.js"></script>
    <script src="/js/highslide/highslide-full.min.js"></script>
    <link rel="stylesheet" href="/js/highslide/highslide.css">
    <style type="text/css">
        @media (max-width: 768px) {
            body {
                background-color: #f0f0f0;
                background: url('/imgs/xsbg.gif');
                background-attachment: fixed;
            }
        }
    </style>
    
    <!--<script type="text/javascript">
      if (document.images) {
        var avatar = new Image();
        avatar.src = '/imgs/avatar.jpg'
        var previews = 'picHD_1.png,picHD_2.png,picHD_3.png,picHD_4.png,picHD_5.png,picHD_6.png,picHD_7.png,picHD_8.png,picHD_9.png,picHD_10.png,picHD_11.png,picHD_12.png,picHD_13.png,picHD_14.png,picHD_15.png,picHD_16.png,picHD_17.png,picHD_18.png,picHD_19.png,picHD_20.png,picHD_21.png,picHD_22.png,picHD_23.png,picHD_24.png,picHD_25.png,picHD_26.png,picHD_27.png,picHD_28.png,picHD_29.png,picHD_30.png,picHD_31.png,picHD_32.png,picHD_33.png,picHD_34.png,picHD_35.png,picHD_36.png,picHD_37.png,picHD_38.png,picHD_39.png,picHD_40.png,picHD_41.png,picHD_42.png'.split(',')
        var previewsPreLoad = []
        for(var i = 0; i < length; i++) {
          previewsPreLoad.push(new Image())
          previewsPreLoad[previewsPreLoad.length - 1].src = '/imgs/preview' + previews[i]
        }
      }
    </script>-->
</head></html>
<body>
    <!-- 背景轮播图功能 -->
    <section class="hidden-xs">
    <ul class="cb-slideshow">
        <li><span>天若</span></li>
        <li><span>有情</span></li>
        <li><span>天亦老</span></li>
        <li><span>我为</span></li>
        <li><span>长者</span></li>
        <li><span>续一秒</span></li>
    </ul>
</section>
    <!-- 欧尼酱功能, 谁用谁知道 -->
    
    <header class="navbar navbar-inverse" id="gal-header">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed"
                    data-toggle="collapse" data-target=".bs-navbar-collapse"
                    aria-expanded="false">
                <span class="fa fa-lg fa-reorder"></span>
            </button>
            <a href="https://yihuishou.gitee.io">
                
                <style>
                    #gal-header .navbar-brand {
                        height: 54px;
                        line-height: 24px;
                        font-size: 28px;
                        opacity: 1;
                        background-color: rgba(0,0,0,0);
                        text-shadow: 0 0 5px #fff,0 0 10px #fff,0 0 15px #fff,0 0 20px #228DFF,0 0 35px #228DFF,0 0 40px #228DFF,0 0 50px #228DFF,0 0 75px #228DFF;
                    }
                </style>
                <!-- 这里使用文字(navbar_text or config.title) -->
                <div class="navbar-brand">骑士の物语</div>
                
            </a>
        </div>
        <div class="collapse navbar-collapse bs-navbar-collapse">
            <ul class="nav navbar-nav" id="menu-gal">
                
                
                <li class="">
                    <a href="/">
                        <i class="fa fa-home"></i>首页
                    </a>
                </li>
                
                
                
                <li class="">
                    <a href="/archives">
                        <i class="fa fa-archive"></i>归档
                    </a>
                </li>
                
                
            </ul>
        </div>
    </div>
</header>
    <div id="gal-body">
        <div class="container">
            <div class="row">
                <div class="col-md-8 gal-right" id="mainstay">
                    
<article class="article well article-body" id="article">
    <div class="breadcrumb">
        <i class="fa fa-home"></i>
        <a href="https://yihuishou.gitee.io">骑士の物语</a>
        >
        <span>SpringDataJPA 分页 排序与动态查询</span>
    </div>
    <!-- 大型设备详细文章 -->
    <div class="hidden-xs">
        <div class="title-article">
            <h1>
                <a href="/2019/03/20/1671325781/">SpringDataJPA 分页 排序与动态查询</a>
            </h1>
        </div>
        <div class="tag-article">
            
            <span class="label label-gal">
                <i class="fa fa-tags"></i>
                
                <a href="/tags/SpringBoot/">SpringBoot</a>
                
            </span>
            
            <span class="label label-gal">
                <i class="fa fa-calendar"></i> 2019-03-20
            </span>
            
        </div>
    </div>
    <!-- 小型设备详细文章 -->
    <div class="visible-xs">
        <center>
            <div class="title-article">
                <h4>
                    <a href="/2019/03/20/1671325781/">SpringDataJPA 分页 排序与动态查询</a>
                </h4>
            </div>
            <p>
                <i class="fa fa-calendar"></i> 2019-03-20
            </p>
            <p>
                
                <i class="fa fa-tags"></i>
                
                <a href="/tags/SpringBoot/">SpringBoot</a>
                
                
                
            </p>
        </center>
    </div>
    <div class="content-article">
        <h3 id="分页"><a href="#分页" class="headerlink" title="分页"></a>分页</h3><p>创建</p>
<p>Page page =PageRequest.of(“1”,”1”);</p>
<p>page - 从零开始的索引页</p>
<p>size- 要返回的页面的大小</p>
<p>sort - 排序</p>
<p>修饰符和类型    方法和描述</p>
<p>你也可以创建没有排序的分页<br>static PageRequest    of(int page, int size)</p>
<p>static PageRequest    of(int page, int size, Sort.Direction direction, String… properties)<br>更方便的是可以一行代码创建有排序方向和属性的分页<br>static PageRequest    of(int page, int size, Sort sort)<br>比如我们想遍历整个数据表，就可以使用分页遍历，这样不至于一次把数据全部加载到内存。</p>
<p>修饰符和类型    方法和描述<br>Pageable    first() 请求第一页。<br>Sort    getSort() 返回排序参数。<br>Pageable    next() 请求下一个页面。<br>PageRequest    previous() 请求前一页。<br>注意：在使用next()方法时，不要把pageable.next()直接作为参数传入方法，如repository.findAll(page.next())这样的写法会导致死循环。查看next()方法的源码发现这个方法只是帮我们new了一个新的Pageable对象，原来的pageable还是没啥变化。一直next()下去也只是在原地踏步。</p>
<pre><code>public Pageable next() {
    return new PageRequest(getPageNumber() + 1, getPageSize(), getSort());
}</code></pre><p>正确的写法：</p>
<p>repository.findAll(pageable = pageable.next());</p>
<p>Spring Data Jpa除了会通过命名规范帮助我们扩展Sql语句外，还会帮助我们处理类型为Pageable的参数，将pageable参数转换成为sql语句中的条件，同时，还会帮助我们处理类型为Page的返回值，当发现返回值类型为Page，Spring Data Jpa将会把数据的整体信息、当前数据的信息，分页的信息都放入到返回值中。这样，我们就能够方便的进行个性化的分页查询。</p>
<p>总页数</p>
<p>int getTotalPages()<br>元素的总数</p>
<p>long getTotalElements()<br>返回当前页的索引（是第几页）</p>
<p>int getNumber()<br>返回作为List的页面内容</p>
<p>List<t> getContent()<br>返回当前在这个页上的元素的数量</t></p>
<p>int getNumberOfElements()<br>返回用于请求当前页的Pageable</p>
<p>default Pageable    getPageable()<br>返回页的大小。</p>
<p>int getSize()<br>返回页的排序参数。</p>
<p>Sort getSort()<br>页面是否有内容。</p>
<p>boolean hasContent()<br>是否有下一页。</p>
<p>boolean hasNext()<br>是否有上一页</p>
<p>boolean hasPrevious()<br>当前页是否是第一个</p>
<p>boolean isFirst()<br>当前页是否是最后一个</p>
<p>boolean isLast()<br>下一页的Pageable</p>
<p>Pageable nextPageable()<br>上一页的Pageable</p>
<p>Pageable previousPageable()</p>
<h3 id="排序"><a href="#排序" class="headerlink" title="排序"></a>排序</h3><p>通过一行代码就可以快速使用：</p>
<p>Sort sort = new Sort(Sort.Direction.DESC, “id”);<br>在Sort类中定义了一个枚举类型Direction，该枚举类型声明了两个常量ASC，DESC定义方向。该构造方法的第一个参数指明方向降序（DESC）或升序（ASC），第二个参数指明以id列的值为准进行排序。</p>
<p>你也可以创建一个多属性的Sort实例。</p>
<p>Sort(Sort.Direction direction, List<string> properties)<br>你也可以只传入属性而不声明方向：</string></p>
<p>Sort(String… properties)<br>不过官方已经弃用该方法，推荐使用</p>
<p>public static Sort by(String… properties)<br>当你不声明方向时，默认方向为升序。</p>
<p>public static final Direction DEFAULT_DIRECTION = Direction.ASC;<br>Sort的一些方法</p>
<p>修饰符和类型    方法和描述<br>Sort    and(Sort sort)<br>返回由当前排序的排序顺序与给定的排序顺序组成的新排序。<br>Sort    ascending()<br>返回具有当前设置但升序方向的新排序。<br>static Sort    by(List&lt;Sort.Order&gt; orders)<br>为给定的Sort.Order创建一个新的排序。<br>static Sort    by(Sort.Direction direction, String… properties)<br>创建一个新的排序。<br>static Sort    by(Sort.Order… orders)<br>Creates a new Sort for the given Sort.Orders.<br>static Sort    by(String… properties)<br>Creates a new Sort for the given properties.<br>Sort    descending()<br>返回具有当前设置但顺序相反的新排序。<br>boolean    equals(Object obj)<br>Sort.Order    getOrderFor(String property)<br>根据property获取Order<br>boolean    isSorted()<br>boolean    isUnsorted()<br>Iterator&lt;Sort.Order&gt;    iterator()<br>static Sort    unsorted()<br>返回一个根本没有排序设置的排序实例。<br>Sort.Order<br>Sort.Order是Sort的一个静态内部类，官方说明是：PropertyPath实现了排序的配对。方向和属性。它用于提供排序的输入 。</p>
<p>简单来讲，你可以定义一个Order，在需要时传入order构建Sord实例。</p>
<p>Order(Sort.Direction direction, String property)<br>更独特的使用是加入自己的空处理提示的枚举：</p>
<p>Order(Sort.Direction direction, String property, Sort.NullHandling nullHandlingHint)<br>Sort.NullHandling是可用于排序表达式的空处理提示的枚举。对使用的数据存储的一种提示，用于在非空条目之后对具有空值的条目进行排序。</p>
<p>在需要Sort时，可通过Order创建：</p>
<p>Sort(Sort.Order… orders)<br>Sort.Order的一些方法</p>
<p>修饰符和类型    方法和描述<br>static Sort.Order    asc(String property)<br>创建升序的Order实例<br>static Sort.Order    by(String property)<br>创建默认方向的Order实例<br>static Sort.Order    desc(String property)<br>创建降序的Order实例<br>Sort.Direction    getDirection()<br>Sort.NullHandling    getNullHandling()<br>String    getProperty()<br>Sort.Order    ignoreCase()<br>开启不分大小写排序<br>boolean    isAscending()<br>返回此属性的排序是否要升序。<br>boolean    isDescending()<br>返回此属性的排序是否应该降序。<br>boolean    isIgnoreCase()<br>返回该排序是否区分大小写。<br>Sort.Order    nullsFirst()<br>返回 Sort.Order 使用 Sort.NullHandling.NULLS_FIRST 作为空处理提示。First：第一个<br>Sort.Order    nullsLast()<br>返回 Sort.Order 使用Sort.NullHandling.NULLS_LAST 作为空处理提示。Last：最后一个<br>Sort.Order    nullsNative()<br>返回 Sort.Order 使用Sort.NullHandling.NATIVE 作为空处理提示。NATIVE：原生的<br>Sort.Order    with(Sort.Direction direction)<br>创建Order实例.<br>Sort.Order    with(Sort.NullHandling nullHandling)<br>创建Order实例.<br>Sort    withProperties(String… properties)<br>创建Order实例.<br>Sort.Order    withProperty(String property)<br>创建Order实例.</p>
<h3 id="动态查询"><a href="#动态查询" class="headerlink" title="动态查询"></a>动态查询</h3><p>Example<customer> example = Example.of(customer);</customer></p>
<p>of 支持两个参数 示例对象实例 和 对象参数匹配器 ExampleMatcher</p>
<p>默认的参数匹配器会忽略 null，使用的动态参数应设置在对象实例中。</p>
<p>Customer customer = new Customer();</p>
<p>customer.setParm1(“xxxxx”);</p>
<p>Example<customer> example = Example.of(customer);</customer></p>

    </div>
</article>


                </div>
                <aside class="col-md-4 gal-left" id="sidebar">
    <!-- 此为sidebar的搜索框, 非搜索结果页面 -->
<aside id="sidebar-search">
    <div class="search hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <form class="form-inline clearfix" id="search-form" method="get"
              action="/search/index.html">
            <input type="text" name="s" class="form-control" id="searchInput" placeholder="搜索文章~" autocomplete="off">
            <button class="btn btn-danger btn-gal" type="submit">
                <i class="fa fa-search"></i>
            </button>
        </form>
    </div>
</aside>
    <aside id="sidebar-author">
    <div class="panel panel-gal" data-aos="flip-right" data-aos-duration="3000">
        <div class="panel-heading" style="text-align: center">
            <i class="fa fa-quote-left"></i>
            挥手の骑士
            <i class="fa fa-quote-right"></i>
        </div>
        <div class="author-panel text-center">
            <img src="/imgs/avatar.jpg" width="140" height="140"
                 alt="个人头像" class="author-image">
            <p class="author-description"></p>
        </div>
    </div>
</aside>
    
    <!-- 要配置好leancloud才能开启此小工具 -->
    
    
    <aside id="sidebar-recent_posts">
    <div class="panel panel-gal recent hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <div class="panel-heading">
            <i class="fa fa-refresh"></i>
            近期文章
            <i class="fa fa-times-circle panel-remove"></i>
            <i class="fa fa-chevron-circle-up panel-toggle"></i>
        </div>
        <ul class="list-group list-group-flush">
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/08/18/55226946/">agent v3.2.1 插件激活码</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/07/22/2412014068/">干掉 CMS 未来属于 ZGC</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/07/21/4075219928/">OpenJDK 和 OracleJDK 的抉择</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/07/20/368594680/">Flutter 音乐播放器开发之路（一）</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/07/15/3650854255/">XaaS 到底是什么？</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/07/15/4036766117/">让 Windows 10 开机自动登录</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/07/14/466733536/">给 Flutter 项目初始化构建提个速</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/06/12/4125727764/">JavaScript 中 Splice 函数与数组塌陷</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/06/12/1586694155/">在 Java 中缩写 Lambda 表达式</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/06/04/2276828982/">博客文章规范</a>
                </span>
            </li>
            
        </ul>
    </div>
</aside>
    
    
    <aside id="sidebar-rand_posts">
    <div class="panel panel-gal recent hidden-xs" data-aos="fade-up" data-aos-duration="2000">
        <div class="panel-heading">
            <i class="fa fa-refresh"></i>
            随机文章
            <i class="fa fa-times-circle panel-remove"></i>
            <i class="fa fa-chevron-circle-up panel-toggle"></i>
        </div>
        <ul class="list-group list-group-flush">
            
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2018/04/08/4119657311/">BAT 出身的人就很厉害吗？</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/04/17/1986098977/">Java 与闭包</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2017/11/10/723704985/">Java 中判断字符串是否为纯数字</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/02/28/435757353/">Java 中格式化数字的四种方式</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/05/28/2418838881/">JavaScript 中的分号战争</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2018/09/01/1499471298/">SpringBoot 中的 Json 格式化配置</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2017/10/23/618326027/">SpringBoot 整合 Mybatis 爬坑之路</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2019/01/14/2168753306/">太阳可能没有核聚变</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2020/07/22/2412014068/">干掉 CMS 未来属于 ZGC</a>
                </span>
            </li>
            
            <li class="list-group-item">
                <span class="post-title">
                    <a href="/2017/12/22/2700866660/">解决 IDEA 打包输出缺少 mybatis 配置的 SQL 文件问题</a>
                </span>
            </li>
            
        </ul>
    </div>
</aside>
    
    
    <aside id="gal-sets">
        <div class="panel panel-gal hidden-xs" data-aos="fade-up" data-aos-duration="2000">
            <ul class="nav nav-pills pills-gal">

                
                <li>
                    <a href="/2019/03/20/1671325781/index.html#sidebar-tags" data-toggle="tab" id="tags-tab">热门标签</a>
                </li>
                
                
                <li>
                    <a href="/2019/03/20/1671325781/index.html#sidebar-friend-links" data-toggle="tab" id="friend-links-tab">友情链接</a>
                </li>
                
                
                <li>
                    <a href="/2019/03/20/1671325781/index.html#sidebar-links" data-toggle="tab" id="links-tab">个人链接</a>
                </li>
                
            </ul>
            <div class="tab-content">
                
                <div class="cloud-tags tab-pane nav bs-sidenav fade" id="sidebar-tags">
    
    <a href="/tags/SpringSecurity/" style="font-size: 17.134336015123687px;" class="tag-cloud-link">SpringSecurity</a>
    
    <a href="/tags/Xml/" style="font-size: 8.84953158331318px;" class="tag-cloud-link">Xml</a>
    
    <a href="/tags/随笔/" style="font-size: 8.465707085151537px;" class="tag-cloud-link">随笔</a>
    
    <a href="/tags/大前端/" style="font-size: 14.855954938833815px;" class="tag-cloud-link">大前端</a>
    
    <a href="/tags/Dart/" style="font-size: 11.24445699473034px;" class="tag-cloud-link">Dart</a>
    
    <a href="/tags/Flutter/" style="font-size: 10.630809214427678px;" class="tag-cloud-link">Flutter</a>
    
    <a href="/tags/Go/" style="font-size: 11.760261310624859px;" class="tag-cloud-link">Go</a>
    
    <a href="/tags/IDEA/" style="font-size: 8.004599676902556px;" class="tag-cloud-link">IDEA</a>
    
    <a href="/tags/Java/" style="font-size: 12.36063535412255px;" class="tag-cloud-link">Java</a>
    
    <a href="/tags/JavaScript/" style="font-size: 19.218252224672526px;" class="tag-cloud-link">JavaScript</a>
    
    <a href="/tags/Mysql/" style="font-size: 12.993514795738903px;" class="tag-cloud-link">Mysql</a>
    
    <a href="/tags/Oracle/" style="font-size: 16.510210307394367px;" class="tag-cloud-link">Oracle</a>
    
    <a href="/tags/Photoshop/" style="font-size: 14.095595879488151px;" class="tag-cloud-link">Photoshop</a>
    
    <a href="/tags/RPG-Maker-MV/" style="font-size: 14.971099334894273px;" class="tag-cloud-link">RPG Maker MV</a>
    
    <a href="/tags/Restful/" style="font-size: 8.040897017626321px;" class="tag-cloud-link">Restful</a>
    
    <a href="/tags/Redis/" style="font-size: 9.833481837759184px;" class="tag-cloud-link">Redis</a>
    
    <a href="/tags/SQL/" style="font-size: 13.473500715712248px;" class="tag-cloud-link">SQL</a>
    
    <a href="/tags/SpringBoot/" style="font-size: 16.76289116494222px;" class="tag-cloud-link">SpringBoot</a>
    
    <a href="/tags/Swagger/" style="font-size: 8.112090298828079px;" class="tag-cloud-link">Swagger</a>
    
    <a href="/tags/Windows/" style="font-size: 9.863057549132737px;" class="tag-cloud-link">Windows</a>
    
    <a href="/tags/Deepleanring/" style="font-size: 11.409255638993095px;" class="tag-cloud-link">Deepleanring</a>
    
    <a href="/tags/Vue/" style="font-size: 11.120952860833214px;" class="tag-cloud-link">Vue</a>
    
    <a href="/tags/Docker/" style="font-size: 11.357821421065104px;" class="tag-cloud-link">Docker</a>
    
    <a href="/tags/Hexo/" style="font-size: 8.063205743780735px;" class="tag-cloud-link">Hexo</a>
    
    <a href="/tags/VsCode/" style="font-size: 18.454729463643062px;" class="tag-cloud-link">VsCode</a>
    
    <a href="/tags/SpringCloud/" style="font-size: 10.540222035984124px;" class="tag-cloud-link">SpringCloud</a>
    
</div>
                
                
                <div class="friend-links tab-pane nav bs-sidenav fade" id="sidebar-friend-links">
    
    <li>
        <a href="http://noodlefighter.com" target="_blank">虾包</a>
    </li>
    
    <li>
        <a href="https://loli.la" target="_blank">超级叫了</a>
    </li>
    
    <li>
        <a href="https://konata9.github.io" target="_blank">吃土的小此方</a>
    </li>
    
</div>
                
                
                <div class="links tab-pane nav bs-sidenav fade" id="sidebar-links">
    
    <li>
        <a href="https://github.com/yihuishou" target="_blank">Github</a>
    </li>
    
    <li>
        <a href="https://gite.com/yihuishou" target="_blank">码云</a>
    </li>
    
    <li>
        <a href="https://www.zhihu.com/people/hei-yi-tian-shi-48" target="_blank">知乎</a>
    </li>
    
</div>
                
            </div>
        </div>
    </aside>
    
</aside>
            </div>
        </div>
    </div>
    <footer id="gal-footer">
    <div class="container">
        Copyright © 2018 挥手の骑士 Powered by <a href="https://hexo.io/" target="_blank">Hexo</a>.&nbsp;Theme by <a href="https://github.com/ZEROKISEKI" target="_blank">AONOSORA</a>
    </div>
</footer>

<!-- 回到顶端 -->
<div id="gal-gotop">
    <i class="fa fa-angle-up"></i>
</div>
</body>
<script src="/js/activate-power-mode.js"></script>
<script>

    // 配置highslide
	hs.graphicsDir = '/js/highslide/graphics/'
    hs.outlineType = "rounded-white";
    hs.dimmingOpacity = 0.8;
    hs.outlineWhileAnimating = true;
    hs.showCredits = false;
    hs.captionEval = "this.thumb.alt";
    hs.numberPosition = "caption";
    hs.align = "center";
    hs.transitions = ["expand", "crossfade"];
    hs.lang.number = '共%2张图, 当前是第%1张';
    hs.addSlideshow({
      interval: 5000,
      repeat: true,
      useControls: true,
      fixedControls: "fit",
      overlayOptions: {
        opacity: 0.75,
        position: "bottom center",
        hideOnMouseOut: true
      }
    })

    // 初始化aos
    AOS.init({
      duration: 1000,
      delay: 0,
      easing: 'ease-out-back'
    });

</script>
<script>
	POWERMODE.colorful = 'true';    // make power mode colorful
	POWERMODE.shake = 'true';       // turn off shake
	// TODO 这里根据具体情况修改
	document.body.addEventListener('input', POWERMODE);
</script>
<script>
    window.slideConfig = {
      prefix: '/imgs/slide/background',
      ext: 'jpg',
      maxCount: '6'
    }
</script>
<script src="/js/hs.js"></script>
<script src="/js/blog.js"></script>



</html>